home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / QB4SWLIB.ARJ / QB4SWLIB.DOC < prev    next >
Text File  |  1991-11-10  |  17KB  |  481 lines

  1.                           Shareware Function Library
  2.  
  3.                                by Brian Veditz
  4.  
  5.  
  6.  
  7.             The  enclosed  libraries  were  designed  specifically for
  8.         shareware  authors, but  can be  used  by anyone  needing such
  9.         functions.  Some of the functions  are general and can be used
  10.         for  any  program and  some  are  more specific.   I  have not
  11.         released   the   source   because   some   of   the  functions
  12.         (Specifically the  Register and Encryption  functions) will be
  13.         more  protected  this  way.   You can  find  the  QLB  and LIB
  14.         enclosed which are easily added to your programs.
  15.  
  16.             Two of the most important features of this Library are the
  17.         Registration  Codes  and  the  Encryption  Process.   In these
  18.         functions you have to ability  to make your software protected
  19.         from unregistered users  or users illegally  gaining access to
  20.         information   they  shouldn't   be   into.   Using   both  the
  21.         registration  codes and  the  Encryption process  on important
  22.         passwords or perhaps your  name as it is  shown in the program
  23.         will protect your software so  that it is almost impossible to
  24.         crack.  Using  the Encryption  and Registration  on words that
  25.         are shown in your software  such as "Unregistered Version" can
  26.         keep from hackers editing or EXE or Data files.
  27.  
  28.             There is no cost  for using these routines  and you are at
  29.         your own risk  when doing so.  As  far as I  know there are no
  30.         bugs or other  errors in the  coding, but your  on your own if
  31.         you choose  to use this  software.  I accept  no liability for
  32.         the use of  these functions.  If  you do use  these routines a
  33.         registered version of  your software would  be a nice jesture,
  34.         but in  no way  required.  If you  have any  problems with the
  35.         functions let me know, my BBS Number is (818) 999-5488 and you
  36.         can contact me there.
  37.  
  38.             Using the routines is simple.   When your coding in the QB
  39.         Environment type  QB /L QB4SWLIB.QLB  and the  routine will be
  40.         loaded for your use.  When  you wish to compile your software,
  41.         after running  your basic program  through BC  and choosing to
  42.         link, it will ask you  Library names, type in QB4SWLIB.LIB and
  43.         your program will  be compiled (Or choose  that file name from
  44.         the  QB environment  if thats  where  you do  your compiling).
  45.         Also, at the beginning of your program you must add the line
  46.                       '$INCLUDE: QB4SWLIB.BI
  47.         this  line sets  up your  program  to recognize  the functions
  48.         added by the QB4SWLIB.
  49.  
  50.             Sorry for the  poor quality of  the Documentation, I'm not
  51.         too good  at this and  I'm also  typing fast to  get this done
  52.         (boy is it boring), as I said, if you having any problems give
  53.         my board a call and leave  me a comment (its an instant access
  54.         board).  Hope these routines  will be of some  use to you, and
  55.         Good Luck!
  56.  
  57.                                                   Brian Veditz
  58.                                                 The Informer BBS
  59.                                                  (818) 999-5488
  60.  
  61.  
  62.             Registration  Codes  are  used in  software  to  engage or
  63.         disable   certain   features   from   registered/un-registered
  64.         versions of your software.   The registrations codes used here
  65.         can be up to  6 digites long (999999).   The Code is a private
  66.         code for use in the Registering.  The code should be different
  67.         for each program you make, but  be sure you keep this code for
  68.         registering users for a specific program.
  69.  
  70.         --------------------------------------------------------------
  71.  
  72.         Name:  Get.Register
  73.  
  74.         Use:  Ok!=Get.Register!(Name$, Try!, Code%)
  75.  
  76.         Purpose:  Check if a registration code is correct.
  77.  
  78.         Example:  Ok!=Get.Register!("Brian Veditz", 229694, 2930)
  79.  
  80.         Further Information:
  81.  
  82.             This  function is  used in  conjunction with  the Register
  83.         Function.  Whenever you create a  piece of software you should
  84.         pick  a new  code% which  can be  any number  from 0  to 32767
  85.         (Greater then 0 is suggested).  The Try! above is the code the
  86.         user  enters as  his registration  number.   When you  want to
  87.         register the software you  have the user enter  his / her name
  88.         exactly  as  they want  it  (the Register  functions  are case
  89.         sensitive) and the code (as Try!)  that they are given by you.
  90.         If the number  is correct they get  a 1 returned  and if it is
  91.         wrong a 0  is returned.  Use  these values in  the software to
  92.         enable/disable the features or whatever that you want.
  93.  
  94.  
  95.         Name:  Register
  96.  
  97.         Use:  Reg!=Register!(Name$, Code%)
  98.  
  99.         Purpose:  Make a registration code for a specific name and
  100.                   code.
  101.  
  102.         Example:  Reg! = Register!("Brian Veditz", 2930)
  103.  
  104.         Further Information:
  105.  
  106.             The  Registration  function  is  used  to  find  what  the
  107.         registration code for a specific  name (or other string) would
  108.         be.  The code  after it, 2930  above, which can  be any number
  109.         under  32767 is  used as  an  encoding process.   This routine
  110.         would be  used for  your private  software.  Be  sure that the
  111.         Code% in your private software (2930 above) is the same as the
  112.         software your user is using.  If  the # is different the users
  113.         software will  not register.  When  you run  this routine with
  114.         the correct code  and the name  exactly as your  user wants it
  115.         Register will return  a Registration code  value which you can
  116.         in turn give to your users.  No two users should have the same
  117.         code, but it is  not impossible.  If for  some reason they do,
  118.         try adding a "!" to the end, or whatever.  If they do have the
  119.         same code,  it won't cause  any problems of  course except for
  120.         your records.
  121.  
  122.             Encryption is used for hiding  strings in your programs or
  123.         data files from prying eyes.  The Encryption process is fairly
  124.         simple to use and in design,  but can be difficult to crack if
  125.         you take advantage of all the features of the functions.  Read
  126.         the advanced section for more uses for these functions.
  127.  
  128.         Name:  Encrypt
  129.  
  130.         Use:  Newln$ = Encrypt$(Ln$, Code%, Add$)
  131.  
  132.         Purpose:  Encrypt Names, Lines, Passwords, Etc.
  133.  
  134.         Example:  Newln$ = Encrypt$("Brian Veditz",3487, ".,)(*&%$@!")
  135.  
  136.         Further Information:
  137.  
  138.             When encrypting, The Newln$ will be the encryted line that
  139.         the function  returns.  Ln$  is the  Line to  Encrypt.  Code%,
  140.         like in the registration process,  is a misc number to further
  141.         add to the  encryption process.  Add$  are characters that you
  142.         will  allow to  be encrypted  besides  the standard  set.  The
  143.         standard set is  A-Z, a-z, 1-9, <Space>  and the "'" character
  144.         (not the  quotes around  it though).   If there  are any other
  145.         characters you wish to  use you can include  them in the add$.
  146.         Even  if  you  don't have  any,  to  further  personalize your
  147.         encryption process,  it is advised  to add  some characters to
  148.         the Add$.  Whatever you do,  don't duplicate any characters or
  149.         use any characters allready in the standard set.
  150.  
  151.         Name:  Decrypt
  152.  
  153.         Use:  Newln$ = Decrypt$(Ln$, Code%, Add$)
  154.  
  155.         Purpose:  Decrypt lines encrypted with above function.
  156.  
  157.         Example:  Newln$ = Decrypt$("@9h24F'7gh31",3487, ".,)(*&%$@!")
  158.  
  159.         Further Information:
  160.  
  161.             If you wish to decrypt a string you must know the code you
  162.         used to encrypt it  and any ADD$ you  may have used, otherwise
  163.         you won't be able to decrypt  the String.  If someone tries to
  164.         break your coding  without the proper  decrypting ADD$ and the
  165.         decrypt program can't decrypt  a certain character because its
  166.         not in the ADD$,  the decrypt program will  throw one in there
  167.         instead of telling the decrypter.  This makes it a little more
  168.         difficult for  a cracker since  they won't know  what they can
  169.         use and what they can't.  By using the code% and ADD$ its very
  170.         unlikely someone will  crack your code, and  not without a lot
  171.         of work (doubtfull  they would even know  how).  If you forgot
  172.         the ADD$ or Code% you might  as well forget decrypting it, and
  173.         don't come to me since I can't do it either (The crypting work
  174.         is done by you not by me, I only have a routine here, your the
  175.         one who will do the coding by using the Code% and add$).
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.             Below are different  string manipulation functions.  These
  183.         are  useful for  filtering, centering,  replacing, translating
  184.         and in other ways manipulating strings into the form you want.
  185.         Most are simple to  use and you'll know  what they do at first
  186.         glance.
  187.  
  188.  
  189.         Name:  Center
  190.  
  191.         Use:  PRINT Center$(Ln$, Length%)
  192.  
  193.         Purpose:  Center a line
  194.  
  195.         Example:  PRINT Center$ ("this line will Centered", 80)
  196.  
  197.         Further Information:
  198.  
  199.             This function  is used to  center a line  however long you
  200.         wish it to be.  The length% is the length of the area you want
  201.         to center the string in.  80 is the lenght of a screen, so the
  202.         example above would center the line on the screen.  If you are
  203.         in 40 columns you would use 40  instead of 80.  If you wish to
  204.         center   a   line  to   put   into   a  box   you   could  do:
  205.            LN$ = Center$(LN$, 22)
  206.         Ln$ would now be  padded enough spaces that  if you printed it
  207.         in a box 22 characters wide it would be centered.  If the line
  208.         is longer then length% the line will not be Centered.
  209.  
  210.         Name:  Justify
  211.  
  212.         Use:  Ln$ = Justify$(Ln$, Length%)
  213.  
  214.         Purpose:  Justify a line to the proper length.
  215.  
  216.         Example:  Print Justify$("Justify this line", 20)
  217.  
  218.         Further Information:
  219.  
  220.             This function will justify a line to the proper characters
  221.         long  (as  specified  in length%).   This  is  great  for word
  222.         processors and  such that pretty  up the docs.   The docs here
  223.         have been justified.  You can  specify the length as according
  224.         to what your users may have the Right and left margins set for
  225.         or whatever other uses you may have for this.
  226.  
  227.         Name:  Spaceit
  228.  
  229.         Use:  Ln$ = Spaceit$(Ln$, Length%)
  230.  
  231.         Purpose:  Replace tabs with length% of spaces.
  232.  
  233.         Example:  Ln$ = Spaceit$(Chr$(9)+Ln$, 6)
  234.  
  235.         Further Information:
  236.  
  237.             This will replace the tabs in each line with the amount of
  238.         spaces specified  in length% (6  in the  above example).  Good
  239.         for removing  those tabs  and putting  in something  easier to
  240.         work with.
  241.  
  242.  
  243.         Name:  Replace
  244.  
  245.         Use:  Ln$ = Replace$(Ln$, Find$, Change$)
  246.  
  247.         Purpose:  Replace all occurances of one string with another.
  248.  
  249.         Example:  Ln$ = Replace$(Ln$, "Hello", "Hi")
  250.  
  251.         Further Information:
  252.  
  253.             Replace is a  handy little function  that will replace all
  254.         occurances  of one  string with  another.   As with  the above
  255.         example, all occurances  of "Hello" in Ln$  will be changed to
  256.         the  word "Hi".   The string  to  change to  can be  longer or
  257.         shorter than  the original  string, the  replace function will
  258.         take care  of everything.   Another handy  addition to  a word
  259.         processor or text converter program.
  260.  
  261.         Name:  Translate
  262.  
  263.         Use:  Ln$ = Translate$(Ln$, old$, new$)
  264.  
  265.         Purpose: Run string(s) through a translate table.
  266.  
  267.         Example:  Ln$ = Replace$(Ln$, "!?;", "...")
  268.  
  269.         Further Information:
  270.  
  271.             A translate table  has uses sometimes.   The above example
  272.         would exchange  all occurances of  "!?;" with  "."'s.  Why?  I
  273.         dunno, but  heres another  idea.  Suppose  your writing  a BBS
  274.         program and someone calls without an IBM but you don't want to
  275.         make  seperate non-Ibm  character menus  for those  few.  Well
  276.         great, just  put those  IBM characters  in Old$  and something
  277.         thats   semi-equivalent  in   New$  using   standard  keyboard
  278.         characters, and  now you can  support those  users.  There are
  279.         many other uses that may come to mind.
  280.  
  281.         Name:  Filter
  282.  
  283.         Use: Ln$ = Filter$ (Ln$, Find$)
  284.  
  285.         Purpose:  Filter out all characters in Find$
  286.  
  287.         Example:  Ln$ = Filter$ (Ln$, ",!%&.-+")
  288.  
  289.         Further Information:
  290.  
  291.             In  the  example  above   the  filter$  would  filter  out
  292.         characters you may not want when getting a number.  The filter
  293.         can be used to filter out any characters that you may not want
  294.         when getting a string of  some type.  The Filter function will
  295.         remove the  character completely like  it was  never there.  A
  296.         nice toy  to add to  a BBS or  modem program when  you want to
  297.         remove most occurances of line noise.
  298.  
  299.  
  300.  
  301.  
  302.  
  303.         Name:  Parser
  304.  
  305.         Use:  A% = Parser%(COMMAND$, Split$(), Find$)
  306.  
  307.         Purpose:  Split up lines at a given character
  308.  
  309.         Example A% = Parser%("Line-1 Line-2 Line-3", Split$(), " ")
  310.  
  311.         Further Information:
  312.  
  313.             The parser can be used to seperate words/commands from the
  314.         Command$.  The Find$ is the character you want to separate at,
  315.         this is  normally a space,  but it can  be anything.  Split$()
  316.         must be dimensioned before  you use it to  how many splits you
  317.         expect  to  allow.   You  can  run  the  the  command$ through
  318.         multiple parsers if  you like, it'll just  take a little extra
  319.         coding.   The  above  example  will  send  back  a%  as  3 and
  320.         Split$(1) as "Line-1", Split$(2)  as "Line-2" and Split$(3) as
  321.         "Line-3"...  the number  of words your  command$ is split into
  322.         is defined in the returned value (A% above).
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.             The following are functions that deal with numbers.
  363.  
  364.  
  365.         Name:  Pick
  366.  
  367.         Use: Num! = Pick!(Low!, High!)
  368.  
  369.         Purpose:  Pick a random number between Low! and High!
  370.  
  371.         Example: Num! = Pick!(100, 200)
  372.  
  373.         Further Information:
  374.  
  375.             An average little random  number generator.  This one will
  376.         pick numbers  between two  numbers.  It  supports numbers into
  377.         the billions.
  378.  
  379.         Name:  Round
  380.  
  381.         Use: Num# = Round#(Num#)
  382.  
  383.         Purpose:  Round to nearest possitive or negative number.
  384.  
  385.         Example:  Num# = Round#(-305.33)
  386.  
  387.         Futher Information:
  388.  
  389.             This  will  round  numbers.   Works  better  then  the Int
  390.         function and handles both positive or negative numbers.
  391.  
  392.         Name:  Roundcent
  393.  
  394.         Use:  Num# = Roundcent#(Num#)
  395.  
  396.         Purpose:  Round to nearest positive cent.
  397.  
  398.         Example:  Num# = Round#(305.3345)
  399.  
  400.         Futher Information:
  401.  
  402.             This little  function will  round to  the nearest positive
  403.         cent.  Useful for those tax  programs.  This will get you past
  404.         the math  junk in  your programs and  get you  back to drawing
  405.         your pretty menus.  :)
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.             Date and Time conversions into a Human version.
  423.  
  424.         Name:  Realdate
  425.  
  426.         Use: Newdate$ = Realdate$(Date$)
  427.  
  428.         Purpose:  Convert date to a nice format
  429.  
  430.         Example:  PRINT Realdate$(date$)
  431.  
  432.         Further Information:
  433.  
  434.             Tired of  those stupid  11/09/91 or  11-09-1991 formats of
  435.         dates.  This  will convert both  formats into  a nice readable
  436.         date.  The above would be  displayed "November 9, 1991".  This
  437.         support goes into the  early next century if  you have the old
  438.         date format "11/09/91"  and even further if  you use the newer
  439.         format (11-09-1991).
  440.  
  441.         Name:  Realtime
  442.  
  443.         Use:  Thetime$ = Realtime$(Time$)
  444.  
  445.         Purpose:  Convert the time into an easy readable form.
  446.  
  447.         Example:  PRINT Realtime$(Time$)
  448.  
  449.         Further Information:
  450.  
  451.             This will  convert the  normal "18:32:21"  into the format
  452.         "6:32 pm".  It gets  rid of the seconds  but converts the time
  453.         you give to the proper time, minutes and AM/PM.
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.